<template>
	<u-popup :show="showSign" @close="showSign = false" mode="center"
		:customStyle="{'width':'316px','position':'relative', 'backgroundColor': 'transparent'}" @open="showSign = true" round="20"
		bgColor="#333">
		<view class="sign-container">
			<view class="sign-title">
				黄石智慧门楼牌
			</view>
			<view class="sign-content">
				<view class="info-item">
					<text class="label">门牌地址</text>
					<text class="value">{{ signInfo.address }}</text>
				</view>
				<view class="info-item">
					<text class="label">社区（行政村）</text>
					<text class="value">{{ signInfo.sq.sqname }}</text>
				</view>
				<view class="info-item">
					<text class="label">道路名称（村湾组）</text>
					<text class="value">{{ signInfo.daoLuMC }}</text>
				</view>
				<view class="info-item">
					<text class="label">门牌号</text>
					<text class="value">{{ signInfo.mph }}</text>
				</view>
				<view class="info-item">
					<text class="label">门牌类型</text>
					<text class="value">{{ signInfo.typeName }}</text>
				</view>
				<view class="info-item">
					<text class="label">责任区</text>
					<text class="value">{{ signInfo.polices[0].pcs }}</text>
				</view>
			</view>
		</view>
		<view class="close-btn-wrap" @tap="showSign = false"></view>
	</u-popup>
</template>

<script>
	import {
		getSignData
	} from '@/common/api_store.js'
	export default {
		// props: {
		// 	signData: {
		// 		type: Object,
		// 		default: () => {}
		// 	}
		// },
		data() {
			return {
				showSign: false,
				signInfo: {}
			}
		},
		created() {
			// this.getData()
		},
		// watch: {
		// 	signData: {
		// 		handler(newObj, oldObj) {
		// 			if (newObj && newObj.id) {
		// 				this.signInfo = newObj
		// 				uni.setStorageSync('signInfo', JSON.stringify(newObj))
		// 			}
		// 		},
		// 		immediate: true
		// 	}
		// },
		methods: {
			async getData(qrCode) {
				const res = await getSignData({
					'Access-Key': 'f9b81ad78bbfhgr436kkutud',
					'Secret-Key': '03d920798bbf0cda411d6ce5'
				},{
					qrCode
				})
				if (res.status === 200) {
					this.signInfo = res.data
					this.showSign = true
					uni.setStorageSync('qrCode', qrCode)
				}
				console.log(res, 'ressss')
			}
		}
		
	}
</script>

<style lang="scss" scoped>
	.sign-container {
		width: 316px;
		// height: 333px;
		padding: 52rpx 32rpx;
		background: #FFFFFF;
		border-radius: 20px;
		box-sizing: border-box;
		
		.sign-title {
			margin-bottom: 52rpx;
			font-weight: 600;
			font-size: 36rpx;
			color: #34314F;
			line-height: 50rpx;
			text-align: center;
			font-style: normal;
		}
		
		.info-item {
			display: flex;
			justify-content: space-between;
			margin-bottom: 28rpx;
			.label {
				font-weight: 400;
				font-size: 28rpx;
				color: #34314F;
				line-height: 40rpx;
				text-align: left;
			}
			.value {
				display: block;
				max-width: 396rpx;
				font-weight: 400;
				font-size: 28rpx;
				color: #34314F;
				line-height: 40rpx;
				text-align: right;
			}
		}
		
	}

	.close-btn-wrap {
		position: relative;
		top: 60rpx;
		left: 50%;
		transform: translateX(-50%);
		width: 48rpx;
		height: 48rpx;
		background: url('@/static/images/close-icon.png') no-repeat center center;
		background-size: 100% 100%;
	}
</style>